#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);

	char a[50][4], b[50][2];
	for (int i = 0; i < n; i++)
		scanf("%s %d %d", a[i], &b[i][0], &b[i][1]);

	for (int i = 0; i < n; i++)
		if (b[i][0] < 15 || b[i][0] > 20 || b[i][1] < 50 || b[i][1] > 70)
			printf("%s\n", a[i]);
	return 0;
}